//
//  CZHomButtonItem.swift
//  sinaWeiboswift
//
//  Created by 段文杰 on 16/4/13.
//  Copyright © 2016年 段文杰. All rights reserved.
//

import UIKit

class CZHomButtonItem: UIButton {

    init(title: String){
    super.init(frame: CGRectZero)
//        self.titleLabel?.text = title
        self.setTitle(title, forState: .Normal)
        self.setTitleColor(UIColor.init(red: ( CGFloat(arc4random_uniform(256)) / 255.0), green: ( CGFloat(arc4random_uniform(256)) / 255.0), blue: ( CGFloat(arc4random_uniform(256)) / 255.0), alpha: 1.0), forState: .Normal)
        self.setImage(UIImage.init(named: "navigationbar_arrow_down"), forState: .Normal)
        self.sizeToFit()
    
    
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        self.titleLabel?.frame.origin.x = 0
        self.imageView?.frame.origin.x = (self.titleLabel!.frame.size.width + 3)
        
        
    }
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
